package Com.Hupochuan.Dal.Tab;

import java.util.Hashtable;

import Com.Hupochuan.Dal.DBManager.DBManager;
import Com.Hupochuan.Vo.FeedBack;

public class FeedBackTab {
	/*
	 * 本类私有对象
	 */
	private DBManager<FeedBack> dbManager = new DBManager<FeedBack>(FeedBack.class);
	
	/*
	 * 单一实例
	 */
	private FeedBackTab(){}
	private static FeedBackTab feedBackTab = new FeedBackTab();
	public static FeedBackTab getObject(){
		return feedBackTab;
	}
	
	/*
	 * 添加数据
	 */
	public int appendData(String content,String linkman,String url,String createIp){
		//参数部分
		StringBuffer sqlBuff = new StringBuffer();
		Hashtable<String,Object> paraHash = new Hashtable<String,Object>();
		
		//sql语句部分
		sqlBuff.append(" insert into FeedBack set ");
		sqlBuff.append(" 	content=${content}, ");
		sqlBuff.append(" 	linkman=${linkman}, ");
		sqlBuff.append(" 	url=${url}, ");
		sqlBuff.append(" 	createIp=${createIp}, ");
		sqlBuff.append(" 	createTime=now() ");
		
		//sql参数部分
		paraHash.put("content",content);
		paraHash.put("linkman",linkman);
		paraHash.put("url",url);
		paraHash.put("createIp",createIp);
		
		//执行sql 并返回参数
		return dbManager.updateSql(sqlBuff.toString(),paraHash);
	}
}
